//package com.yunhe.device.repository.device.impl;
//
//import org.neo4j.ogm.model.Result;
//import org.neo4j.ogm.session.Session;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Repository;
//
//import java.util.HashMap;
//import java.util.Iterator;
//import java.util.List;
//import java.util.Map;
//
//@Repository
//public class DeviceTreeDao {
//
//    @Autowired
//    private Session session;
//
//    public Map<String, Map<String, Object>> getDeviceTree(List<Long> deviceTreeId) {
//        Map<String, Object> params = new HashMap<>();
//        params.put("idList", deviceTreeId);
//        String cql = "match(tree:DeviceTree)<-[:DEVICE_TREE_NODE_OF]-(dev) where ID(tree) in {idList}"
//                + " return ID(dev) as id,dev.title as title,dev.code as code,labels(dev)[0] as type,ID(tree) as tid";
//        Result query = session.query(cql, params);
//        Map<String, Map<String, Object>> result = new HashMap<>();
//        Iterator<Map<String, Object>> iterator = query.iterator();
//        while (iterator.hasNext()) {
//            Map<String, Object> objectMap = new HashMap<>();
//            Map<String, Object> map = iterator.next();
//            objectMap.put("id", map.get("id"));
//            objectMap.put("code", map.get("code"));
//            objectMap.put("title", map.get("title"));
//            objectMap.put("type", map.get("type"));
//            result.put(map.get("tid").toString(), objectMap);
//        }
//        return result;
//    }
//}
